﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ page import="client.ChatClient" %>
<%@ page import="client.RoomClient" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>userlist</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!-- 设置用户列表刷新时间为8秒 -->
	<meta http-equiv="refresh" content="3">  
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="text/javascript">//选择特定用户聊天
   function selectuser(username)
   {
    // alert("before选择用户"+username);
     parent.messageFrame.chatForm.receiver.value=username;
   	 
   }
</script>
  </head>
  <% 
      String roomname=(String)session.getAttribute("roomname");
    //    System.out.println("roomname: "+roomname);
      RoomClient rc= new RoomClient();
      Vector<String> userlist=rc.getUserList(roomname);//用户列表
     // System.out.println("users in room "+userlist.size());
   %>

  <body bgcolor="#f0c0c0">

    <font color="#0000ff">当前在线人数:</font>
    <font color="#ff0000"> <%=userlist.size() %></font><br>
      [<a href="userlist.jsp" onClick=selectuser("所有人")>所有人</a>] <br>
     <% for(int i=0;i<userlist.size();i++)
      {
    %>
    [<a href="userlist.jsp" onClick=selectuser("<%=userlist.get(i)%>")><%=userlist.get(i)%></a>]<br>
     <%} %>
     
  </body>
</html>
